package com.woniu.service.imple;

import com.woniu.adapter.ClientApplicationAdapter;
import com.woniu.outlet.po.ClientApplications;
import com.woniu.outlet.po.PotentialCustomers;
import com.woniu.service.IClientApplicationService;
import com.woniu.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientApplicationService implements IClientApplicationService {

    @Autowired
    private ClientApplicationAdapter clientApplicationAdapter;

    @Override
    public int applications(ClientApplications clientApplications) {
        int applications = clientApplicationAdapter.applications(clientApplications);
        return applications;
    }

    //首先经理可以查看所有的没有处理的申请书
    @Override
    public List<ClientApplications> findapplications() {
        List<ClientApplications> findapplicationlist = clientApplicationAdapter.findapplications();
        return findapplicationlist;
    }

    //营销经理来处理发过来的申请(默认经理是同意的),这个时侯经理给客户经理发送手机消息，需要使用到队列
    @Override
    public int handleapplications(ClientApplications clientApplications) {
        int handleapplications = clientApplicationAdapter.handleapplications(clientApplications);
        return handleapplications;
    }

    //客户经理发来的申请，营销经理没有同意，拒绝了
    @Override
    public Integer rejectapplication(Integer app_id) {
        Integer rejectapplication = clientApplicationAdapter.rejectapplication(app_id);
        return rejectapplication;
    }


    //第二种管理潜在客户的方法：是由营销经理直接对潜在客户进行分配
    // ，这个也涉及到分布式事务的一致性！！
    @Override
    public Integer distributionpotentialcustomer(PotentialCustomers potentialCustomers) {
        Integer distributionpotentialcustomer = clientApplicationAdapter.distributionpotentialcustomer(potentialCustomers);
        return distributionpotentialcustomer;
    }


}
